<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <script src="/meetTWO/public/static/vue/vue.js" type="text/javascript"></script>
    <link href="/meetTWO/public/static/bootstrap/css/bootstrap.min.css" type="text/css" rel="Stylesheet" />
    <script src="/meetTWO/public/static/jquery/jquery-3.3.1.js" type="text/javascript"></script>
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/meetTWO/public/static/index/css/index.css">
    <style>
        .check {
            display: inline-flex;
            margin: 20px 50px 50px 0;
        }

        .check>div {
            margin-left: 20px;
        }

        

        .contents {
            width: 300px !important;
            height: 40px !important;
        }
        .title{
            width: 600px;
        }
    </style>
</head>

<body>
    <div class="col-md-8">
        <div class="check">
            <div>
                <label>时间查询：</label>
                <input type="date" name="date" id="time" onchange="select_time(this.value)">
            </div>
            <div>
                <label>账号查询：</label>
                </label>
                <input type="text" name="number" id="num" onchange="select_time(this.value)">
            </div>
        </div>
        <div class="result">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>账号</th>
                        <th>昵称</th>
                        <th>标题</th>
                        <th class="contents">内容</th>
                        <th>发表时间</th>
                        <th>删除</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>



        <!-- <div class='modal fade' id='myModal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
            <div class='modal-dialog'>
                <div class='modal-content'>
                    <div class='modal-header'>
                        <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>
                            &times;
                        </button>
                    </div>
                    <div class='modal-body'>
                        <center>
                            <div class='title'>
                                '+result.page_title+'
                            </div>
                        </center>
                        <input type='hidden' id='page_id' value='result.page_id}'>
                        <div class='user_post'>
                            <div class='user_body'>
                                <div class='user_head'>
                                    <img src='/meetTWO/public/static/picture/userHeadImg/result.Number}/img.png' onerror='javascript:this.src='/meetTWO/public/static/picture/defaultHead.jpg';'
                                        alt=''>
                                    <div class='user_sign'>
                                        <span>'+result.user+'</span>
                                        <br>
                                        <span class='user_time'>result.page_time}</span>
                                    </div>
                                </div>
                                <div class='user_text'>
                                    '+result.page_content+'
                                </div>
                                <div class='user_foot'>
                                    <div class='li-info user_span'>
                                        <span class='glyphicon glyphicon-comment' id='comments'>'+result.comment_num+'</span>
                                        <span class='glyphicon glyphicon-eye-open' id='view_num'>'+result.view_num+'</span>
                                        <span class='glyphicon glyphicon-heart content' id='content'>'+result.content+'</span>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class='modal-footer'>
                        <button type='button' class='btn btn-default' data-dismiss='modal'>关闭
                        </button>
                    </div>
                </div>
            </div>
        </div> -->
</body>
<script>
    function select_time(val) {
        var number = $("#num").val();
        var time = $("#time").val();
        $.ajax({
            url: '/meetTWO/public/admin/index/check',
            type: 'post',
            data: { time: time, num: number },
            success: function (data) {
                $('table tbody td').remove();
                var item;
                var obj = data;
                $.each(obj, function (i, result) {
                    console.log(result)
                    item = "<tr><td>" + i + 1 + "</td><td>" + result.Number + "</td><td>" + result.user
                        + "</td><td>" + result.page_title + "</td><td class='content'>" + "<button class='btn btn-primary btn-lg' data-toggle='modal' data-target='#myModal'>查看内容</button><div class='modal fade' id='myModal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button></div><div class='modal-body'><center><div class='title'>"
                        +result.page_title+"</div></center><input type='hidden' id='page_id' value='result.page_id}'><div class='user_post'><div class='user_body'><div class='user_head'><img src='/meetTWO/public/static/picture/userHeadImg/"+result.Number+"/img.png' onerror='javascript:"+this.src+"='/meetTWO/public/static/picture/defaultHead.jpg';'alt=''><div class='user_sign'><span>"
                        +result.user+"</span><br><span class='user_time'>"+result.page_time+"</span></div></div><div class='user_text'>"
                        +result.page_content+"</div><div class='user_foot'><div class='li-info user_span'><span class='glyphicon glyphicon-comment' id='comments'>"+result.comment_num+"</span><span class='glyphicon glyphicon-eye-open' id='view_num'>"
                        +result.view_num+"</span><span class='glyphicon glyphicon-heart content' id='content'>"
                        +result.content+"</span></div></div></div></div></div><div class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>关闭</button></div></div></div></div></td><td>" 
                        + result.page_time +
                        "</td><td><a href='/meetTWO/public/admin/index/check_del?id=" + result.page_id + "'><img src='meetTWO/public/static/picture/delete.png'></a></td><tr>"
                    $('.table').append(item);
                })
            }
        })
    }
</script>

</html>